<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D 开门</title>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    body{
        background-color: black;
    }
    .door{
        perspective: 500px;
        width: 150px;
        height: 250px;
        background-color: white;
        margin: 100px auto;
        cursor: pointer;
    }
    .room{
        width: 150px;
        height: 250px;
        background-color: black;
        backface-visibility: hidden;
        transform-style: preserve-3d;
        /* transform: rotate3d(1,1,0,45deg); */
        transition: all 3s;
        transform-origin: right;
    }
    .room:hover.room{
        transform: rotateY(-45deg);
    }
</style>
<body>
    <div class="door">
        <div class="room"></div>
    </div>
</body>
</html>